<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../static/css/public.css">
</head>

<body>
    <div>
        <form action="/vimPwd" class="public" method="POST" id="form">
            <h1>修改密码</h1>
            <input type="password" placeholder="密码" name="pwd" id="pwd">
            <input type="password" placeholder="确认密码" name="tryPwd" id="tryPwd">
            <div class="alert alert-light text-center invisible" role="alert">
                <font id="msgId"></font> <small id="comment" class="form-text text-muted">{{msg}}</small>
            </div>
            <div>
                <input type="submit" style="width:8rem;" class="btn" value="确认修改">
                <input type="button" style="width: 8rem;" class="btn" value="退出" onclick="comeback()">
            </div>
        </form>

    </div>

    <script src="../static/js/jquery-3.6.0.min.js"></script>
    <script src="../static/js/jquery.form.js"></script>
    <script>
        $(document).ready(function () {
            // bind 'myForm' and provide a simple callback function
            $('#form').ajaxForm(function (message) {
                var messageJson = JSON.parse(message);
                // console.log(messageJson);
                if (messageJson.code === 200) {
                    window.location.href = "/manager";
                } else {
                    alert(messageJson.msg);
                }
            });
        });
    </script>
    <script>


        //退出
        function comeback() {
            window.location.href = '/manager'
        }


        //包装消息警告框(显示和隐藏)

        function alert_fn(msg) {
            $('#msgId').text(msg);
            $('.alert').removeClass('invisible');
            setTimeout(() => {
                $('.alert').addClass('invisible');
            }, 3000);
        }






    </script>
</body>


</html>